package main

import (
	"fmt"
	"time"
)

func p(i interface{}) {
	fmt.Println(i)
}
func main() {
	//指定时间->时间戳
	timeString := "2017-05-06 07:08:09"
	loc, _ := time.LoadLocation("Local")
	te, _ := time.ParseInLocation("2006-01-02 15:04:05", timeString, loc)
	t1 := te.Unix()
	p(t1)

	//当前时间->时间戳
	t2 := time.Now().Unix()
	p(t2)

	//指定时间戳->时间
	t3 := time.Unix(t1, 0).Format("2006-01-02 15:04:05")
	p(t3)

	//当前时间戳->时间

	t4 := time.Unix(time.Now().Unix(), 0).Format("2006-01-02 15:04:05")
	p(t4)
}
